<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018-10-16
 * Time: 17:08
 */

namespace App\Http\Controllers\Validator;
use Validator;


class CustomersVail
{
    //添加客源
    public static function add($params)
    {
        $return = true;
        $validator = Validator::make($params, [
            'c_user_name'          => 'required',//客户姓名
            'c_user_phone'         => 'required',//客户联系方式
            'c_trading_type'       => 'required',//交易类型
            'c_secondary_area'     => 'required',//区县ID
            'c_acreage_max'        => 'required',//面积最大值
            'c_acreage_min'        => 'required',//面积最小值
            'c_entrust_time'       => 'required',//委托时间
            'c_use_type'           => 'required',//用途类型
            'c_source_type'        => 'required', //来源
            'c_store_id'           => 'required', //部门ID
            'c_employees_id'       => 'required', //员工ID
            'c_entrust_time'       => 'required'  //委托时间
        ]);
        if ($validator->fails()) {
            $return = false;
        }
        return $return;
    }
    //修改客源
    public static function edit($params)
    {
        $return = true;
        $validator = Validator::make($params, [
            'c_id'                 => 'required',//客源ID
            'c_user_name'          => 'required',//客户姓名
            'c_user_phone'         => 'required',//客户联系方式
            'c_trading_type'       => 'required',//交易类型
            'c_secondary_area'     => 'required',//区县ID
            'c_acreage_max'        => 'required',//面积最大值
            'c_acreage_min'        => 'required',//面积最小值
            'c_entrust_time'       => 'required',//委托时间
            'c_use_type'           => 'required',//用途类型
            'c_source_type'        => 'required', //来源
            'c_buy_status'         => 'required'
        ]);
        if ($validator->fails()) {
            $return = false;
        }
        return $return;
    }
    /**
     * app检索条件验证
     */
    public static function condition($params)
    {
        $return = true;
        $validator = Validator::make($params, [
            'authories'  => 'required',//权限
            'system_id'  => 'required',//系统非管理组ID
            'did'        => 'required', //部门ID
            'uid'        => 'required'//用户ID
        ]);
        if ($validator->fails()) {
            $return = false;
        }
        return $return;
    }
}